#include <QCoreApplication>
#include <QDateTime>

#include "audiospeaker.h"

int main(int argc, char *argv[]) {
    QCoreApplication a(argc, argv);

    AudioSpeaker speaker;
    speaker.start();

    QThread::sleep(std::chrono::seconds(5));

    int i = 0;

    for (i = 0; i < 100; i++) {
        speaker.write(nullptr, i, 0);
        qDebug() << QDateTime::currentDateTime() << QThread::currentThreadId()
                 << "send " << i;
    }

    QThread::sleep(std::chrono::seconds(50));

    for (; i < 200; i++) {
        speaker.write(nullptr, i, 0);
        qDebug() << QDateTime::currentDateTime() << QThread::currentThreadId()
                 << "send " << i;
    }

    speaker.wait();

    return a.exec();
}
